module.exports = function (sequelize, DataTypes) {
    const Menu = sequelize.define('Menu', {
        pid: {
            type: DataTypes.INTEGER,
            allowNull: false,
            comment: '菜单父Id'
        },
        level: {
            type: DataTypes.INTEGER,
            allowNull: false,
            comment: '菜单级别'
        },
        name: {
            type: DataTypes.STRING,
            allowNull: false,
            comment: '菜单名称'
        },
        code: {
            type: DataTypes.STRING,
            comment: '菜单代码'
        },
        select: {
            type: DataTypes.BOOLEAN,
            allowNull: false,
            comment: '是否被选中'
        },
        type: {
            type: DataTypes.INTEGER,
            allowNull: false,
            comment: '类型  1：菜单  2：按钮'
        },
        route: {
            type: DataTypes.STRING,
            // allowNull: false,
            comment: '路由'
        },
        createdByUserId: {
            type: DataTypes.STRING,
            allowNull: false,
            comment: '创建人Id'
        }
    }, {
        timestamps: true, //createAt updateAt是否显示
        createdAt: "createdTime", // 将createdAt设为自定义字段createdTime
        updatedAt: "updatedTime",
        deletedAt: "deletedTime",
        paranoid: true,
    })

    return Menu
}

